package com.michael.leetcode;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

@Slf4j
public class FreqAlphabets_1309 {
    public String freqAlphabets(String s) {
        int is = s.length()-1;
        int ie = s.length();
        String re = "";
        while (is >= 0){
            int tmp = 0;
            if (s.charAt(is) != '#'){
                tmp = Integer.parseInt(s.substring(is,ie));
                is--;
                ie--;
            }else {
                is = is-2;
                tmp = Integer.parseInt(s.substring(is,ie-1));
                ie = is;
                is--;
            }
            log.info("tmp {}",tmp);

           re =  (char)(tmp+96)+ re;
        }
        return re;
    }

    @Test
    public void test(){
        String s = "10#11#12";
        String s1 = freqAlphabets(s);

        log.info("dd {}", s1);
    }
}